<template>
  <div class="index fx item-c just-c">
    <div class="taps">
      <div class="wrap fx just-c item-c">
        <Login @toRegister="login = false" v-if="login" />
        <Register @toLogin="login = true" v-else />
      </div>
    </div>
  </div>
</template>

<script>
import Login from "@/components/Login";
import Register from "@/components/Register";
import { mapState } from "vuex";
export default {
  data() {
    return {
      login: true,
    };
  },
  computed: {
    ...mapState(["info", 'isLogin']),
  },
  created() {
    if (this.isLogin) {
      const path = this.info.role === "tch" ? "tchIndex" : "stuIndex";
      this.$router.push("/" + path);
    }
  },
  components: {
    Login,
    Register,
  },
};
</script>

<style lang="scss" scoped>
.wrap {
  width: 500px;
  height: 500px;
  border: 1px solid #409eff;
  box-shadow: 2px 2px 5px #409eff;
}

.index {
  height: 100%;
}
</style>
